﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Icoders.MarketTracker.Core.Repository.Transaction;
using Icoders.MarketTracker.Web.Lib.Command.Transactions.Orders;

namespace Icoders.MarketTracker.Web.Lib.CommandHandler.Orders.Impl
{
    public class AddOrderLineItemCommandHandler : IAddOrderLineItemCommandHandler
    {
        private IPurchaseOrderRepository _purchaseOrderRepository;

        public AddOrderLineItemCommandHandler(IPurchaseOrderRepository purchaseOrderRepository)
       {
           _purchaseOrderRepository = purchaseOrderRepository;
       }

        public void Execute(AddOrderLineItemCommand cmd)
        {
            try
            {
                _purchaseOrderRepository.AddLineItem(cmd.DocId,cmd.CmdId,cmd.Quantity,cmd.ProductId,cmd.ReasonId,cmd.CmdDateCreated);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
